import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    confirmData:[],
    totalPrice:null,
    commentTicketData:null
  },
  getters: {
  },
  mutations: {
    //添加数据到确认支付页面
    addDataToConfirmView(state,data) {
      state.confirmData=data.data
      state.totalPrice=data.totalPrice
      localStorage.setItem('confirmData',JSON.stringify(data))
    },
    //添加数据到评论页面
    addDataToCommentTicket(state,data) {
      state.commentTicketData=data
      console.log(state.commentTicketData);
    },
    //跳转商品详情页
    goToGoodsDetail(state,data) {
      let id = data.id
      if (id==undefined) {
        id = 15694
      }
      data.router.push({ name: "goodsDetailView", params: { id } });
    },
  },
  actions: {
  },
  modules: {
  }
})
